package com.gpframework.module.brand.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.gpframework.module.brand.domain.BrandStoreUserRela;
import com.gpframework.module.brand.domain.vo.BrandStoreUserRelaVo;
import com.gpframework.module.brand.mapper.BrandStoreUserRelaMapper;
import com.gpframework.module.brand.service.IBrandStoreUserRelaService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @ClassName BrandStoreUserRela
 * @Author gpframework
 * @Date 2022-04-11
 * @Version 1.0.0
 * @Description 门店用户关联Service业务层处理
 */
@Service
public class BrandStoreUserRelaServiceImpl extends ServiceImpl<BrandStoreUserRelaMapper, BrandStoreUserRela> implements IBrandStoreUserRelaService {

    /**
     * @Description 查询列表返回VO 用于返回给前端的列表接口
     * @Author gpframework
     * @Date 2022-04-11
     * @Param [lqw]
     * @Return List<BrandStoreUserRelaVo>
     */
    @Override
    public List<BrandStoreUserRelaVo> listVo(QueryWrapper<BrandStoreUserRela> lqw) {
        return this.baseMapper.listVo(lqw);
    }

    /**
     * @Description 通过查询详情VO 用于返回给前端的列详情接口
     * @Author gpframework
     * @Date 2022-04-11
     * @Param [id]
     * @Return BrandStoreUserRelaVo
     */
    @Override
    public BrandStoreUserRelaVo getVoById(Long id) {
        return this.baseMapper.getVo(id);
    }

    /**
     * 根据用户id删除
     *
     * @param userId
     * @return
     */
    @Override
    public boolean delByUserId(Long userId) {
        int i = this.baseMapper.delByUserId(userId);
        if (i > 0) {
            return true;
        }
        return false;
    }

    /**
     * 获取用户门店关联信息
     *
     * @param userId
     * @return
     */
    @Override
    public List<Long> getUserStoreIdList(Long userId) {
        return this.baseMapper.getUserStoreIdList(userId);
    }
}
